package edu.whu.rose.clock.kps.algorithm.blinks.binding;

import java.io.IOException;

import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;

import edu.whu.rose.clock.kps.algorithm.blinks.index.BlockKeyword;

public class BlockKeywordBinding extends TupleBinding {

	public Object entryToObject(TupleInput input) {
		int block = input.readInt();
		String keyword = input.readString();
		return new BlockKeyword(block, keyword);
	}
	
	public void objectToEntry(Object object, TupleOutput output) {
		BlockKeyword gii = (BlockKeyword)object;
		output.writeInt(gii.getBlock());
		output.writeString(gii.getKeyword());
//		try {
//			output.wr
//			output.write(gii.getKeyword().getBytes("UTF-8"));
//		}
//		catch (IOException ex) {
//			ex.printStackTrace();
//		}
	}

}
